const api = require('./api')
// pages/mana_right/mana_right.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    show_chapters:[],
  },

  set_opt(e){api.set_opt(this, e)},

  view_section(e){
    let index1 = e.currentTarget.dataset.index1
    let index2 = e.currentTarget.dataset.index2
    let section = this.data.list[index1].section_list[index2]
    let sec_id = section.id
    let name = section.name
    wx.navigateTo({
      url:'/pages/sysConfig/config_textBook/section/section?sec_id=' + sec_id + '&sec_name=' + name
    })
  },

  show_sec(e){
    let chap_id = this.data.list[e.currentTarget.id].chap_id
    let show_chapters = this.data.show_chapters
    let of_index = show_chapters.indexOf(chap_id)
    if(of_index>-1){
      show_chapters.splice(of_index,1)
    }else{
      show_chapters.push(chap_id)
    }
    this.setData({
      show_chapters:show_chapters
    })
  },



  // 显示添加界面
  add_btn(){
    this.setData({
      show_mask:true
    })
  },

  // 取消创建权限
  cancel(){
    this.setData({
      show_mask:false,
      name:'',
    })
  },

  onLoad:function(options){
    api.page_init(this)
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  },

  

})